<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content=
    "application/xhtml+xml; charset=iso-8859-1" />
    <title>
      LVM2-2.03.08
    </title>
    <link rel="stylesheet" type="text/css" href="../stylesheets/lfs.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.79.1" />
    <link rel="stylesheet" href="../stylesheets/lfs-print.css" type=
    "text/css" media="print" />
  </head>
  <body class="blfs" id="blfs-9.1">
    <div class="navheader">
      <h4>
        Beyond Linux<sup>�</sup> From Scratch <span class="phrase">(System
        V</span> Edition) - Version 9.1
      </h4>
      <h3>
        Chapter&nbsp;5.&nbsp;File Systems and Disk Management
      </h3>
      <ul>
        <li class="prev">
          <a accesskey="p" href="jfsutils.html" title=
          "jfsutils-1.1.15">Prev</a>
          <p>
            jfsutils-1.1.15
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="aboutlvm.html" title=
          "About Logical Volume Management (LVM)">Next</a>
          <p>
            About Logical Volume Management (LVM)
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="filesystems.html" title=
          "Chapter&nbsp;5.&nbsp;File Systems and Disk Management">Up</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Beyond Linux� From Scratch     (System V Edition) - Version 9.1">Home</a>
        </li>
      </ul>
    </div>
    <div class="sect1" lang="en" xml:lang="en">
      <h1 class="sect1">
        <a id="lvm2" name="lvm2"></a>LVM2-2.03.08
      </h1>
      <div class="package" lang="en" xml:lang="en">
        <h2 class="sect2">
          Introduction to LVM2
        </h2>
        <p>
          The <span class="application">LVM2</span> package is a set of tools
          that manage logical partitions. It allows spanning of file systems
          across multiple physical disks and disk partitions and provides for
          dynamic growing or shrinking of logical partitions, mirroring and
          low storage footprint snapshots.
        </p>
        <p>
          This package is known to build and work properly using an LFS-9.1
          platform.
        </p>
        <h3>
          Package Information
        </h3>
        <div class="itemizedlist">
          <ul class="compact">
            <li class="listitem">
              <p>
                Download (HTTP): <a class="ulink" href=
                "https://sourceware.org/ftp/lvm2/LVM2.2.03.08.tgz">https://sourceware.org/ftp/lvm2/LVM2.2.03.08.tgz</a>
              </p>
            </li>
            <li class="listitem">
              <p>
                Download (FTP): <a class="ulink" href=
                "ftp://sourceware.org/pub/lvm2/LVM2.2.03.08.tgz">ftp://sourceware.org/pub/lvm2/LVM2.2.03.08.tgz</a>
              </p>
            </li>
            <li class="listitem">
              <p>
                Download MD5 sum: 92691c782db85150a05f2452ab10825c
              </p>
            </li>
            <li class="listitem">
              <p>
                Download size: 2.4 MB
              </p>
            </li>
            <li class="listitem">
              <p>
                Estimated disk space required: 34 MB (add at least 600 MB for
                tests in the /tmp directory; additionally transient files can
                grow up to around 500 MB)
              </p>
            </li>
            <li class="listitem">
              <p>
                Estimated build time: 0.2 SBU (using parallelism=4; add 16
                SBU for tests)
              </p>
            </li>
          </ul>
        </div>
        <h3>
          LVM2 Dependencies
        </h3>
        <h4>
          Required
        </h4>
        <p class="required">
          <a class="xref" href="../general/libaio.html" title=
          "libaio-0.3.112">libaio-0.3.112</a>
        </p>
        <h4>
          Optional
        </h4>
        <p class="optional">
          <a class="xref" href="mdadm.html" title="mdadm-4.1">mdadm-4.1</a>,
          <a class="xref" href="reiserfs.html" title=
          "reiserfsprogs-3.6.27">reiserfsprogs-3.6.27</a>, <a class="xref"
          href="../general/valgrind.html" title=
          "Valgrind-3.15.0">Valgrind-3.15.0</a>, <a class="xref" href=
          "../general/which.html" title=
          "Which-2.21 and Alternatives">Which-2.21</a>, <a class="xref" href=
          "xfsprogs.html" title="xfsprogs-5.4.0">xfsprogs-5.4.0</a> (all five
          may be used, but are not required, for tests), and <a class="ulink"
          href=
          "https://github.com/jthornber/thin-provisioning-tools">thin-provisioning-tools</a>
        </p>
        <p class="usernotes">
          User Notes: <a class="ulink" href=
          "http://wiki.linuxfromscratch.org/blfs/wiki/lvm2">http://wiki.linuxfromscratch.org/blfs/wiki/lvm2</a>
        </p>
      </div>
      <div class="kernel" lang="en" xml:lang="en">
        <h2 class="sect2">
          <a id="lvm2-kernel" name="lvm2-kernel"></a>Kernel Configuration
        </h2>
        <p>
          Enable the following options in the kernel configuration and
          recompile the kernel:
        </p>
        <div class="admon note">
          <img alt="[Note]" src="../images/note.png" />
          <h3>
            Note
          </h3>
          <p>
            There are several other Device Mapper options in the kernel
            beyond those listed below. In order to get reasonable results if
            running the regression tests, all must be enabled either
            internally or as a module. The tests will all time out if Magic
            SysRq key is not enabled.
          </p>
        </div>
        <pre class="screen">
<code class="literal">Device Drivers ---&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&gt; [CONFIG_MD]
    &lt;*/M&gt;   Device mapper support                         [CONFIG_BLK_DEV_DM]
    &lt;*/M/ &gt;   Crypt target support                        [CONFIG_DM_CRYPT]
    &lt;*/M/ &gt;   Snapshot target                             [CONFIG_DM_SNAPSHOT]
    &lt;*/M/ &gt;   Thin provisioning target                    [CONFIG_DM_THIN_PROVISIONING]
    &lt;*/M/ &gt;   Mirror target                               [CONFIG_DM_MIRROR]
Kernel hacking ---&gt;
  [*] Magic SysRq key                                     [CONFIG_MAGIC_SYSRQ]</code>
</pre>
      </div>
      <div class="installation" lang="en" xml:lang="en">
        <h2 class="sect2">
          Installation of LVM2
        </h2>
        <p>
          Install <span class="application">LVM2</span> by running the
          following commands:
        </p>
        <pre class="userinput">
<kbd class="command">SAVEPATH=$PATH                  &amp;&amp;
PATH=$PATH:/sbin:/usr/sbin      &amp;&amp;
./configure --prefix=/usr       \
            --exec-prefix=      \
            --enable-cmdlib     \
            --enable-pkgconfig  \
            --enable-udev_sync  &amp;&amp;
make                            &amp;&amp;
PATH=$SAVEPATH                  &amp;&amp;
unset SAVEPATH</kbd>
</pre>
        <p>
          The tests use <span class="application">udev</span> for logical
          volume synchronization, so the LVM udev rules and some utilities
          need to be installed before running the tests. If you are
          installing <span class="application">LVM2</span> for the first
          time, and do not want to install the full package before running
          the tests, the minimal set of utilities can be installed by running
          the following instructions as the <code class=
          "systemitem">root</code> user:
        </p>
        <pre class="root">
<kbd class="command">make -C tools install_tools_dynamic &amp;&amp;
make -C udev  install                 &amp;&amp;
make -C libdm install</kbd>
</pre>
        <p>
          To test the results, issue, as the <code class=
          "systemitem">root</code> user:
        </p>
        <pre class="root">
<kbd class="command">make check_local</kbd>
</pre>
        <p>
          Other targets are available and can be listed with <span class=
          "command"><strong>make -C test help</strong></span>. The test
          timings are very dependent on the speed of the disk(s), and on the
          number of enabled kernel options.
        </p>
        <p>
          The tests do not implement the <span class=
          "quote">&ldquo;<span class="quote">expected
          fail</span>&rdquo;</span> possibility, and a small number of test
          failures is expected by upstream. More failures may happen because
          some kernel options are missing. For example, the lack of the
          <span class="emphasis"><em>dm-delay</em></span> device mapper
          target may explain some failures. Some tests are flagged
          <span class="quote">&ldquo;<span class=
          "quote">warned</span>&rdquo;</span> if <a class="ulink" href=
          "https://github.com/jthornber/thin-provisioning-tools">thin-provisioning-tools</a>
          are not installed. A workaround is to add the following flags to
          <span class="command"><strong>configure</strong></span>:
        </p>
        <pre class="userinput">
<kbd class="command">     --with-thin-check=    \
     --with-thin-dump=     \
     --with-thin-repair=   \
     --with-thin-restore=  \
     --with-cache-check=   \
     --with-cache-dump=    \
     --with-cache-repair=  \
     --with-cache-restore= \</kbd>
</pre>
        <p>
          Some tests may hang. They can be removed if necessary, for example:
          <span class="command"><strong>rm
          test/shell/lvconvert-raid-reshape.sh</strong></span>. The tests
          generate a lot of kernel messages, which may clutter your terminal.
          You can disable them by issuing <span class="command"><strong>dmesg
          -D</strong></span> before running the tests (do not forget to issue
          <span class="command"><strong>dmesg -E</strong></span> when tests
          are done).
        </p>
        <div class="admon note">
          <img alt="[Note]" src="../images/note.png" />
          <h3>
            Note
          </h3>
          <p>
            The checks create device nodes in the /tmp directory. The tests
            will fail if /tmp is mounted with the nodev option.
          </p>
        </div>
        <p>
          Now, as the <code class="systemitem">root</code> user:
        </p>
        <pre class="root">
<kbd class="command">make install</kbd>
</pre>
      </div>
      <div class="commands" lang="en" xml:lang="en">
        <h2 class="sect2">
          Command Explanations
        </h2>
        <p>
          <span class=
          "command"><strong>PATH=$PATH:/sbin:/usr/sbin</strong></span>: The
          path must contain <code class="filename">/sbin</code> and
          <code class="filename">/usr/sbin</code> for proper system tool
          detection by the <span class=
          "command"><strong>configure</strong></span> script. This
          instruction ensures that PATH is properly set even if you build as
          an unprivileged user.
        </p>
        <p>
          <em class="parameter"><code>--enable-cmdlib</code></em>: This
          switch enables building of the shared command library. It is
          required when building the event daemon.
        </p>
        <p>
          <em class="parameter"><code>--enable-pkgconfig</code></em>: This
          switch enables installation of <span class=
          "command"><strong>pkg-config</strong></span> support files.
        </p>
        <p>
          <em class="parameter"><code>--enable-udev_sync</code></em>: This
          switch enables synchronisation with <span class=
          "application">Udev</span> processing.
        </p>
        <p>
          <code class="option">--enable-dmeventd</code>: This switch enables
          building of the <span class="application">Device Mapper</span>
          event daemon.
        </p>
      </div>
      <div class="content" lang="en" xml:lang="en">
        <h2 class="sect2">
          Contents
        </h2>
        <div class="segmentedlist">
          <div class="seglistitem">
            <div class="seg">
              <strong class="segtitle">Installed Programs:</strong>
              <span class="segbody">blkdeactivate, dmeventd (optional),
              dmsetup, fsadm, lvm, and lvmdump. There are also numerous
              symbolic links to lvm that implement specific
              functionalities</span>
            </div>
            <div class="seg">
              <strong class="segtitle">Installed Libraries:</strong>
              <span class="segbody">libdevmapper.so and liblvm2cmd.so;
              optional: libdevmapper-event.so, libdevmapper-event-lvm2.so,
              libdevmapper-event-lvm2mirror.so,
              libdevmapper-event-lvm2snapshot.so,
              libdevmapper-event-lvm2raid.so, and
              libdevmapper-event-lvm2thin.so</span>
            </div>
            <div class="seg">
              <strong class="segtitle">Installed Directories:</strong>
              <span class="segbody">/etc/lvm and /lib/device-mapper
              (optional)</span>
            </div>
          </div>
        </div>
        <div class="variablelist">
          <h3>
            Short Descriptions
          </h3>
          <table border="0" class="variablelist">
            <colgroup>
              <col align="left" valign="top" />
              <col />
            </colgroup>
            <tbody>
              <tr>
                <td>
                  <p>
                    <a id="blkdeactivate" name=
                    "blkdeactivate"></a><span class="term"><span class=
                    "command"><strong>blkdeactivate</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is a utility to deactivate block devices.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="dmeventd" name="dmeventd"></a><span class=
                    "term"><span class=
                    "command"><strong>dmeventd</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    (optional) is the Device Mapper event daemon.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="dmsetup" name="dmsetup"></a><span class=
                    "term"><span class=
                    "command"><strong>dmsetup</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is a low level logical volume management tool.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="fsadm" name="fsadm"></a><span class=
                    "term"><span class=
                    "command"><strong>fsadm</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is a utility used to resize or check filesystem on a
                    device.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="lvm" name="lvm"></a><span class=
                    "term"><span class="command"><strong>lvm</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    provides the command-line tools for <span class=
                    "application">LVM2</span>. Commands are implemented via
                    sympolic links to this program to manage physical devices
                    (pv*), volume groups (vg*) and logical volumes (lv*).
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="lvmdump" name="lvmdump"></a><span class=
                    "term"><span class=
                    "command"><strong>lvmdump</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is a tool used to dump various information concerning
                    <span class="application">LVM2</span>.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="vgimportclone" name=
                    "vgimportclone"></a><span class="term"><span class=
                    "command"><strong>vgimportclone</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is used to import a duplicated VG (e.g. hardware
                    snapshot).
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="libdevmapper" name="libdevmapper"></a><span class=
                    "term"><code class=
                    "filename">libdevmapper.so</code></span>
                  </p>
                </td>
                <td>
                  <p>
                    contains the <span class="application">Device
                    Mapper</span> API functions.
                  </p>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
      <p class="updated">
        Last updated on 2020-02-18 14:50:03 -0800
      </p>
    </div>
    <div class="navfooter">
      <ul>
        <li class="prev">
          <a accesskey="p" href="jfsutils.html" title=
          "jfsutils-1.1.15">Prev</a>
          <p>
            jfsutils-1.1.15
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="aboutlvm.html" title=
          "About Logical Volume Management (LVM)">Next</a>
          <p>
            About Logical Volume Management (LVM)
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="filesystems.html" title=
          "Chapter&nbsp;5.&nbsp;File Systems and Disk Management">Up</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Beyond Linux� From Scratch     (System V Edition) - Version 9.1">Home</a>
        </li>
      </ul>
    </div>
  </body>
</html>
